package com.easyim.imserver.config;

import com.easyim.imserver.condition.MockTokenCondition;
import com.easyim.imserver.condition.TokenCondition;
import com.easyim.imserver.service.ITokenService;
import com.easyim.imserver.service.impl.TokenServiceImpl;
import com.easyim.imserver.service.impl.TokenServiceMockImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TokenConfig {

    @Bean
    @Conditional(TokenCondition.class)
    public ITokenService getTokenServiceImpl() {
        TokenServiceImpl tokenService = new TokenServiceImpl();
        return tokenService;
    }

    @Bean
    @Conditional(MockTokenCondition.class)
    public ITokenService getMockTokenServiceImpl() {
        return new TokenServiceMockImpl();
    }


}
